{{ $page := .Page -}}
{{ with .Site.Params.copyright -}}
  {{ $fromYear := "" -}}
  {{ $toYear := "" -}}
  {{ $authors := "" -}}
  {{ if reflect.IsMap . -}}
    {{ $fromYear = .from_year -}}
    {{ $toYear = .to_year -}}
    {{ $authors = .authors -}}
  {{ else -}}
    {{ $authors = . -}}
  {{ end -}}

  <span class="td-footer__copyright">&copy;
    {{ with $fromYear -}}
      {{ . }}&ndash;
    {{- end -}}
    {{ $toYear | default now.Year }}
    <span class="td-footer__authors">
      {{- $authors
            | default (printf "%s Authors" ($.Site.Title | default "Site"))
            | $page.RenderString -}}
    </span>
    {{- /* Trim WS */ -}}
  </span>

  {{- with T "footer_all_rights_reserved" -}}
    <span class="td-footer__all_rights_reserved">
      {{- . -}}
    </span>
  {{- end }}

{{- else -}}

  {{ with .Site.Copyright -}}
    {{/* For historical reasons we process this as HTML rather than markdown. */ -}}
    <span class="td-footer__copyright">
      {{- . | safeHTML -}}
    </span>
  {{- end -}}

{{ end -}}
